package com.rs.qm.modules.sms.controller;

import com.rs.qm.common.utils.PageUtils;
import com.rs.qm.common.utils.R;
import com.rs.qm.modules.sms.entity.MsgPushedEntity;
import com.rs.qm.modules.sms.service.MsgPushedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 消息已推送表
 *
 * @author GuoXunMin
 * @email v450625169@126.com
 * @date 2019-12-27 16:43:34
 */
@RestController
@RequestMapping("pc/msgpushed")
public class MsgPushedController {
    @Autowired
    private MsgPushedService msgPushedService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = msgPushedService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{msgId}")
    public R info(@PathVariable("msgId") Long msgId){
		MsgPushedEntity msgPushed = msgPushedService.selectById(msgId);
        return R.ok().put("msgPushed", msgPushed);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody MsgPushedEntity msgPushed){
		msgPushedService.insert(msgPushed);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody MsgPushedEntity msgPushed){
		msgPushedService.updateById(msgPushed);
        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] msgIds){
		msgPushedService.deleteBatchIds(Arrays.asList(msgIds));
        return R.ok();
    }

}
